#ifndef __LEARNDX_IRENDERDRIVER_H_INCLUDE__
#define __LEARNDX_IRENDERDRIVER_H_INCLUDE__
#include "LDXConfig.h"
#include "IReferenceCounted.h"
#include "mathtools\mathtools.h"
#include "SColorf.h"

namespace ldx
{
	struct SDeviceMap;
	namespace device
	{
		class WinDevice;
	}
	namespace render
	{
		typedef D3D11_VIEWPORT SViewPort;
		class CTexture;
		class CTexturesCache;
		enum E_RASTER_STATE_TYPES;
		enum E_TRANFORM_MATRIX
		{
			ETM_VIEW = 0,
			ETM_PROJECTION = 1,
			ETM_CAMERA = 2,
			ETM_TRANSFORM_COUNT,
		};

		enum E_CLEAR_FLAG
		{
			ECF_COLOR_BUFFER = 0x1,
			ECF_DEPTH_BUFFER = 0x10,
			ECF_STENCIL_BUFFER = 0x100,
			ECF_COLOR_DEPTH_BUFFER = ECF_COLOR_BUFFER | ECF_DEPTH_BUFFER,
			ECF_COLOR_STENCIL_BUFFER = ECF_COLOR_BUFFER | ECF_STENCIL_BUFFER,
			ECF_COLOR_DEPTH_STENCIL_BUFFER = ECF_COLOR_BUFFER | ECF_DEPTH_BUFFER | ECF_STENCIL_BUFFER,
		};
		class CShaderManager;
		class IRenderDriver :public IReferenceCounted
		{
		public:

			virtual ~IRenderDriver() {};

			virtual mt::vector2dui getScreenSize() = 0;

			virtual mt::vector2di getCurrentRenderTargetSize() = 0;

			virtual bool clear(E_CLEAR_FLAG flag, SColorf& color = SColorf(1.f, 1.f, 1.f, 1.f), float depth = 1.0f, uint stencil = 0) = 0;

			virtual bool clearColorBuffer(SColorf& color = SColorf(1.f, 1.f, 1.f, 1.f)) { return false; }

			virtual bool clearDepthBuffer(float depth = 1.0f) { return false; }

			virtual bool clearStencilBuffer(uint stentil = 0) { return false; }

			virtual bool swapChain() = 0 ;

			virtual void setTransform(E_TRANFORM_MATRIX transform, mt::mat4& matrix) {}

			virtual mt::mat4& getTransform(E_TRANFORM_MATRIX transform) = 0;

			virtual void setViewPosition(const mt::vec3f& pos) {}

			virtual mt::vec3f& getViewPosition() = 0;

			virtual void setViewDirection(const mt::vec3f& dir) {}

			virtual mt::vec3f& getViewDirection() = 0;

			virtual CShaderManager* getShaderManager() { return nullptr; }

			virtual SDeviceMap getDeviceMap() = 0;
			
			virtual CTexturesCache* getTexturesCache() { return nullptr; }

			//! add texture
			virtual CTexture* addTexture(std::string& pathName) { return nullptr; }

			virtual int setRasterState(E_RASTER_STATE_TYPES rasterstate) { return -1; }

			//! ori: top-left
			virtual int serRasterViewPort(float width, float height, float topleftX = 0.f, float topleftY = 0.f, float depthmin = 0.f, float depthmax = 1.0f) { return -1; }

			virtual SViewPort getRasterViewPort() {	return SViewPort();	}
		};

	}
}

#endif//! __LEARNDX_IRENDERDRIVER_H_INCLUDE__